Methodologies for Spatially Interpolating Climate Adaptation Options from Econometrics Methods
Author
Maxwell Mkondiwa
1 Introduction
This notebook provides machine learning and spatial methods for assessing the impacts of climate on yields and identifying adaptation options in a spatially explicit manner. The goal is to generate spatially differentiated (gridded) estimates of the effects of weather extremes and adaptation options.
We use publicly available datasets in India to demonstrate these models.
2 Important geospatial R packages: Terra, geodata,sf, sp
# Calibration check: Multi-arm causal RF does not yet calibration check## We use binary causal RF to do thatW_cf_sowing_binary=as.vector(LDSestim_sow$Sowing_Date_Early) # Probability random forest to create weightsW.multi_sowing.forest_binary <-regression_forest(X_cf_sowing, W_cf_sowing_binary,equalize.cluster.weights =FALSE,seed =2)W.hat.multi.all_sowing_binary <-predict(W.multi_sowing.forest_binary, estimate.variance =TRUE)$predictions# Regression forest to get expected responses Y.multi_sowing.forest_binary <-regression_forest(X_cf_sowing, Y_cf_sowing,equalize.cluster.weights =FALSE,seed =2)print(Y.multi_sowing.forest_binary)
GRF forest object of type regression_forest
Number of trees: 2000
Number of training samples: 7562
Variable importance:
1 2 3 4 5 6 7 8 9 10 11 12 13
0.000 0.000 0.001 0.022 0.012 0.647 0.195 0.000 0.066 0.001 0.001 0.005 0.001
14 15 16 17 18 19 20 21
0.001 0.004 0.002 0.024 0.015 0.001 0.001 0.002
varimp.multi_sowing_binary <-variable_importance(Y.multi_sowing.forest_binary)Y.hat.multi.all_sowing_binary <-predict(Y.multi_sowing.forest_binary, estimate.variance =TRUE)$predictions# Fit binary causal RF modelmulti_sowing.forest_binary <-causal_forest(X = X_cf_sowing, Y = Y_cf_sowing, W = W_cf_sowing_binary ,W.hat=W.hat.multi.all_sowing_binary,Y.hat=Y.hat.multi.all_sowing_binary,seed=2) varimp.multi_sowing_cf_binary <-variable_importance(multi_sowing.forest_binary)# Average treatment effectsmulti_sowing_ate_binary=average_treatment_effect(multi_sowing.forest_binary,target.sample ="overlap")multi_sowing_ate_binary
Best linear fit using forest predictions (on held-out data)
as well as the mean forest prediction as regressors, along
with one-sided heteroskedasticity-robust (HC3) SEs:
Estimate Std. Error t value Pr(>t)
mean.forest.prediction 1.069524 0.084024 12.7288 < 2.2e-16 ***
differential.forest.prediction 1.728729 0.280558 6.1617 3.782e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Min. 1st Qu. Median Mean 3rd Qu. Max.
-0.01807 0.18037 0.23215 0.22897 0.27845 0.42748
3.1.2 Understanding Mechanisms
We can use the model to understand how farmers who used different amounts of fertilizer or inputs benefit from early sowing of wheat. In addition, we can investigate if farmers who are above the heat stress threshold gain from early sowing.
X_cf_sowingtau=data.frame(X_cf_sowing,tau.hat_sowing)library(ggplot2)ggplot(X_cf_sowingtau,aes(x = predictions)) +geom_histogram() +xlab('CATE') +geom_vline(xintercept =0, col ='black', linetype ='dashed') +geom_vline(xintercept = multi_sowing_ate_binary["estimate"], col ='red') +theme_bw()